﻿using System;
using System.Collections;
using Microsoft.TeamFoundation.WorkItemTracking.Client;

namespace WITD
{
    /// <summary>
    /// Stores information related to how the user selects to copy work items and related resources to support the 
    /// progress and status reporting mechanism.
    /// </summary>
    public class CustomWork
    {

        private bool _useLog;
        private bool _includeCategories;
        private bool _includeLinkTypes;

        private String _sourceProject;
        private ArrayList _targetProjects;
        private ArrayList _witsToImport;
        private WorkItemStore _sourceStore;
        private WorkItemStore _targetStore;
        private String _sourceCollection;
        private String _targetCollection;
        private int _numberOfOperations;

        private WITDCopyOptions _witOptions;
        private GlobalListCopyOptions _globalListOptions;
        private QueryCopyOptions _queryOptions;
        private IterationCopyOptions _iterationOptions;

        /// <summary>
        /// Stores the user's options regarding how to copy global lists.
        /// </summary>
        public GlobalListCopyOptions GlobalList
        {
            get
            {
                return _globalListOptions;
            }
            set
            {
                _globalListOptions = value;
            }
        }


        /// <summary>
        /// Stores the user's options regarding how to copy work item queries.
        /// </summary>
        public QueryCopyOptions Queries
        {
            get
            {
                return _queryOptions;
            }
            set
            {
                _queryOptions = value;
            }
        }

        /// <summary>
        /// Stores the user's options regarding how to copy project iterations.
        /// </summary>
        public IterationCopyOptions Iterations
        {
            get
            {
                return _iterationOptions;
            }
            set
            {
                _iterationOptions = value;
            }
        }

        /// <summary>
        /// Stores the user's options regarding how to copy work item type definitions.
        /// </summary>
        public WITDCopyOptions WITDs
        {
            get
            {
                return _witOptions;
            }
            set
            {
                _witOptions = value;
            }
        }

        /// <summary>
        /// Stores the user's selection as to whether to include work item categories in the copy process.
        /// </summary>
        public bool IncludeCategories
        {
            get
            {
                return _includeCategories;
            }
            set
            {
                _includeCategories = value;
            }
        }

        /// <summary>
        /// Stores the user's selection as to whether to include work item link types in the copy process.
        /// </summary>
        public bool IncludeLinkTypes
        {
            get
            {
                return _includeLinkTypes;
            }
            set
            {
                _includeLinkTypes = value;
            }
        }

        /// <summary>
        /// The number of operations to be reported on during execution of the user's selected options.
        /// </summary>
        public int NumberOfOperations
        {
            get
            {
                return _numberOfOperations;
            }
            set
            {
                _numberOfOperations = value;
            }
        }

        /// <summary>
        /// The name of the project from which items will be copied.
        /// </summary>
        public String SourceProject
        {
            get
            {
                return _sourceProject;
            }
            set
            {
                _sourceProject = value;
            }
        }

        /// <summary>
        /// The Uri of the project collection in which the source project resides.
        /// </summary>
        public String SourceCollection
        {
            get
            {
                return _sourceCollection;
            }
            set
            {
                _sourceCollection = value;
            }
        }

        /// <summary>
        /// The Uri of the project collection in which the target projects reside.
        /// </summary>
        public String TargetCollection
        {
            get
            {
                return _targetCollection;
            }
            set
            {
                _targetCollection = value;
            }
        }

        /// <summary>
        /// The work item store in which the source project resides.
        /// </summary>
        public WorkItemStore SourceStore
        {
            get
            {
                return _sourceStore;
            }
            set
            {
                _sourceStore = value;
            }
        }

        /// <summary>
        /// The work item store in which the target projects reside.
        /// </summary>
        public WorkItemStore TargetStore
        {
            get
            {
                return _targetStore;
            }
            set
            {
                _targetStore = value;
            }
        }

        /// <summary>
        /// A flag that denotes the user's choice of whether to log the operations during execution.
        /// </summary>
        public bool UseLog
        {
            get
            {
                return _useLog;
            }
            set
            {
                _useLog = value;
            }
        }

        /// <summary>
        /// A collection of Work Item Types selected for copy.
        /// </summary>
        public ArrayList WitsToImport
        {
            get
            {
                return _witsToImport;
            }
            set
            {
                _witsToImport = value;
            }
        }

        /// <summary>
        /// A collection of projects to which items will be copied.
        /// </summary>
        public ArrayList TargetProjects
        {
            get
            {
                return _targetProjects;
            }
            set
            {
                _targetProjects = value;
            }
        }

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="newIncludeCategories">Denotes whether to include project categories in the synchronization process.</param>
        /// <param name="newIncludeLinkTypes">Denotes whether to include collection link types in the synchronization process.</param>
        /// <param name="newUseLog">Denotes whether to log execution results during the synchronization process.</param>
        /// <param name="newQueries">Options that govern how to copy work item queries to target projects.</param>
        /// <param name="newIterations">Options that govern how to copy project iterations to target projects.</param>
        /// <param name="newWITDs">Options that govern how to copy work item types to target projects.</param>
        /// <param name="newGlobalLists">Options that govern how to copy global lists to target collection.</param>
        /// <param name="newSourceProject">The name of the source project.</param>
        /// <param name="newTargetProjects">A list of one or more target project names.</param>
        /// <param name="newWITsToImport">A list of WorkItemType names to copy.</param>
        /// <param name="newSourceStore">The source WorkItemStore.</param>
        /// <param name="newTargetStore">The target WorkItemStore.</param>
        /// <param name="newSourceCollection">The source project collection..</param>
        /// <param name="newTargetCollection">The target project collection..</param>
        /// <param name="newNumberOfOperations">the number of separate reportable operations in the current synchronization session to govern accurate progress reporting.</param>
        public CustomWork(bool newIncludeCategories,
                          bool newIncludeLinkTypes,
                          bool newUseLog,
                          QueryCopyOptions newQueries,
                          IterationCopyOptions newIterations,
                          WITDCopyOptions newWITDs,
                          GlobalListCopyOptions newGlobalLists,
                          String newSourceProject,
                          ArrayList newTargetProjects,
                          ArrayList newWITsToImport,
                          WorkItemStore newSourceStore,
                          WorkItemStore newTargetStore,
                          String newSourceCollection,
                          String newTargetCollection,
                          int newNumberOfOperations)
        {
            this._useLog = newUseLog;
            this._queryOptions = newQueries;
            this._iterationOptions = newIterations;
            this._witOptions = newWITDs;
            this._globalListOptions = newGlobalLists;
            this._includeCategories = newIncludeCategories;
            this._includeLinkTypes = newIncludeLinkTypes;
            this._sourceProject = newSourceProject;
            this._targetProjects = newTargetProjects;
            this._witsToImport = newWITsToImport;
            this._sourceStore = newSourceStore;
            this._targetStore = newTargetStore;
            this._targetCollection = newTargetCollection;
            this._sourceCollection = newSourceCollection;
            this.NumberOfOperations = newNumberOfOperations;
        }
    }
}
